package com.service.impl;


import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.dao.UserDao;
import com.entity.Users;
import com.service.UserService;
@Service
@Transactional
public class UserServiceImpl  implements UserService {

	@Resource
	UserDao ud;
	
	
	@Override
	public Users getUserByLogin(Users u) {
		return ud.getUserByLogin(u);
	}


	@Override
	public Map list(Map map) {
		map.put("rows", ud.list(map));
		map.put("total", ud.getCount(map));
		return map;
	}

	@Override
	public Users get(Integer id) {
		return ud.get(id);
	}

	@Override
	public boolean add(Users u) {
		if(ud.add(u)>0)
			return true;
		return false;
	}

	@Override
	public boolean edit(Users u) {
		if(ud.edit(u)>0)
			return true;
		return false;
	}

	@Override
	public boolean delete(Integer id) {
		if(ud.delete(id)>0)
			return true;
		return false;
	}

	@Override
	public boolean changePwd(Users user) {
		if(ud.editPwd(user)>0){
			return true;
		}
		return false;
	}

}
